package operation;

import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * ClassName: ArrayExer
 * Package: operation
 * Description:
 * User: fzykd
 *
 * @Author: LQH
 * Date: 2023-08-15
 * Time: 21:13
 */

public class ArrayExer1 {
    public static void main(String[] args) {

        int[] arr1,arr2;

        arr1 = new int[]{2,3,5,7,11,17,19};

        for (int i = 0; i < arr1.length; i++) {
            System.out.println(arr1[i]);
        }

        //复制数组 之前是两个引用指向同一个对象
        arr2 = new int[arr1.length];
        for (int i = 0; i < arr1.length; i++) {
            arr2[i] = arr1[i];
        }

        for (int i = 0; i < arr2.length; i++) {
            if (i % 2 == 0){
                arr2[i] = i;
            }
        }

        System.out.println(Arrays.toString(arr1));

    }
}
